import { apiHttp } from '/@/utils/axios';
import type { commonResponse } from './common'
import { PropType } from 'vue';



export interface ProjectBaseModel {
  assignCode?:string ; //发改委固投立项赋码
  capitalNature?:string ;//建设资金性质（是否国有）1:国有资金；2:非国有资金
  constrUnitCode?:string ;//建设单位代码
  constrUnitId?:string ; //建设单位ID
  constrUnitName?:string ;//建设单位名称
  longLatitude?:string ; //项目中心的经纬度
  planAssets?:number ;//计划总投资（万元）
  planEndDate?:string ;//项目计划竣工时间
  planStartDate?:string ;//项目计划开工时间
  projectAddr?:string ;//项目建设地址
  projectId?:string ; //主键id
  projectName?:string ;//建设项目名称
  projectNature?:string ;//建设性质
  projectRegion?:string ;//项目行政区划代码
  projectType?:string ;//项目类别
  projectUsage?:string;
}

export const detailProps = {
  detail: {
    type: Object as PropType<ProjectBaseModel>,
    default: {}
  }
}

export const getProListApi = params => {
  return apiHttp.post({ url: '/project/projectList', params });
}

export const getRegion = () => {
  return apiHttp.post({ url: '/data/region' });
}

export const getRegionProv = params => {
  return apiHttp.post({ url: '/data/regionProv', params });
}
export const getPrjList = params => {
  return apiHttp.post({ url: '/history/prjList', params });
}

export const getProjectBaseApi = (projectId:string) => {
  return apiHttp.post<ProjectBaseModel>({ url: '/project/projectBase', params: { projectId } });
}


export const getProjectCorpApi = params => {
  return apiHttp.post<commonResponse>({ url: '/project/corp', params }, { isTransformRequestResult: false });
}

export const getProjectPersonApi = params => {
  return apiHttp.post<commonResponse>({ url: '/project/person', params }, { isTransformRequestResult: false });
}

export const getProjectSingleApi = params => {
  return apiHttp.post<commonResponse>({ url: '/project/single', params }, { isTransformRequestResult: false });
}

export const getProjectOutsourcingApi = params => {
  return apiHttp.post<commonResponse>({ url: '/project/activity', params }, { isTransformRequestResult: false });
}

export const getprjTreeApi = params => {
  return apiHttp.post<commonResponse>({ url: '/project/tree', params }, { isTransformRequestResult: false });
}

export const getMemorabiliaApi = params => {   //项目大事记
  return apiHttp.post({ url: '/project/memorabilia', params }, { isTransformRequestResult: false });
}


export const getBiddingApi = params => {   //招投标信息(待定)
  return apiHttp.post({ url: '/project/bidding', params }, { isTransformRequestResult: false });
}

export const getContractApi = params => {   // 合同登记
  return apiHttp.post({ url: '/project/contract', params }, { isTransformRequestResult: false });
}

export const getReviewApi = params => {   // 施工图审查
  return apiHttp.post({ url: '/project/review', params }, { isTransformRequestResult: false });
}

export const getPermitApi = params => {   // 施工许可
  return apiHttp.post({ url: '/project/permit', params }, { isTransformRequestResult: false });
}


export const getQualityApi = params => {   // 质量监督/安全监督     1 质量监督  2 安全监督
  return apiHttp.post({ url: '/project/quality', params }, { isTransformRequestResult: false });
}

export const getFinishApi = params => {   // 竣工备案
  return apiHttp.post({ url: '/project/finish', params }, { isTransformRequestResult: false });
}



export interface creditLevel {
  creditGrade: string;
  typeName: string;
  typeNum: string	;
}

export enum creditLevelEnum {
  APP_XYPJ_XYDJ_0001 = 1,
  APP_XYPJ_XYDJ_0002 = 2,
  APP_XYPJ_XYDJ_0003 = 3,
  APP_XYPJ_XYDJ_0004 = 4,
  APP_XYPJ_XYDJ_0005 = 5
}

export const getCompanyCreditLevelApi = objectId => {
  return apiHttp.post<creditLevel[]>({ url:'/corp/creditGrade', params: {objectId} });
}


/*下面是历史业绩*/
export const getPrjTender = params => {
  return apiHttp.post({ url: '/history/prjTender', params });
}

export const getPrjBase = params => {
  return apiHttp.post({ url: '/history/prjBase', params });
}

export const getPrjUnitApi = params => {
  return apiHttp.post<commonResponse>({ url: '/history/prjUnit', params }, { isTransformRequestResult: false });
}

export const getprjTenderApi = params => {
  return apiHttp.post<commonResponse>({ url: '/history/prjTender', params }, { isTransformRequestResult: false });
}

export const getprjRecordApi = params => {
  return apiHttp.post<commonResponse>({ url: '/history/prjRecord', params }, { isTransformRequestResult: false });
}

export const getprjCensorApi = params => {
  return apiHttp.post<commonResponse>({ url: '/history/prjCensor', params }, { isTransformRequestResult: false });
}

export const getprjSgxkApi = params => {
  return apiHttp.post<commonResponse>({ url: '/history/prjSgxk', params }, { isTransformRequestResult: false });
}

export const getprjFinishApi = params => {
  return apiHttp.post<commonResponse>({ url: '/history/prjFinish', params }, { isTransformRequestResult: false });
}
